package org.tgcloud.group.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.tgcloud.group.entity.MjProject;
import org.tgcloud.group.web.controller.dto.home.BusinessPerfomanceDTO;
import org.tgcloud.group.web.controller.dto.home.HomeProjectMsg;
import org.tgcloud.group.web.controller.dto.medium.MediumCountProjectDTO;
import org.tgcloud.group.web.controller.dto.order.ProjectListDTO;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Author: zhy
 * @Created: 2025-09-17-上午9:46
 * @Description: ${description}
 */
public interface MjProjectMapper extends BaseMapper<MjProject> {
    int deleteByPrimaryKey(Integer id);

//    int insert(MjProject record);

    int insertSelective(MjProject record);

    MjProject selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(MjProject record);

    int updateByPrimaryKey(MjProject record);

    List<ProjectListDTO> selectList(@Param("keyword") String keyword, @Param("managerUserId") Integer managerUserId, @Param("executionProgressId") Integer executionProgressId,
                                    @Param("arrivalProgressId") Integer arrivalProgressId, @Param("arrivalWarehouseId") Integer arrivalWarehouseId, @Param("isDiscount") Short isDiscount,
                                    @Param("permissionId") Integer permissionId, @Param("businessId") Integer businessId, @Param("areaId") String areaId,
                                    @Param("cateIds") String cateIds, @Param("projectId") Integer projectId, @Param("status") Short status, @Param("isTimeOut") Short isTimeOut);

    MjProject selectMsgByNameAndId(@Param("projectName") String projectName, @Param("projectId") Integer id);

    int updateStatusById(@Param("projectId") Integer projectId, @Param("status") short status);

    ProjectListDTO selectMsgById(@Param("projectId") Integer projectId);

    ProjectListDTO selectOrderMsgById(@Param("projectId") Integer projectId);

    List<MjProject> selectTestList();

    int updateBusinessUsernameByBusinessId(@Param("businessId") int businessId, @Param("username") String username);

    int updatePermissionNameByPermissionId(@Param("permissionId") int userId, @Param("permissionUsername") String username);

    int updateCheckTimeById(@Param("projectId") Integer projectId, @Param("chooseDate") Date chooseDate);

    int updateContractUrlById(@Param("id") Integer id, @Param("contractUrl") String contractUrl);

    int updateActualValuePriceById(@Param("id") Integer id, @Param("price") String actualValuePrice);

    int updateDiscountById(@Param("id") Integer id, @Param("isDiscount") Short isDiscount, @Param("discountContent") String discountContent,
                           @Param("discountPic") String discountPic);

    List<MjProject> selectListByBusinessIdAndTime(@Param("businessId") int businessId, @Param("startTime") Date startTime,
                                                  @Param("endTime") Date endTime);

    List<MjProject> selectHomeListByBusinessIdAndTime(@Param("businessId") int businessId, @Param("startTime") Date startTime,
                                                      @Param("endTime") Date endTime);

    List<MjProject> selectHomeListByBusinessIdAndTime2(@Param("businessId") int businessId, @Param("yearTime") Date yearTime,
                                                       @Param("monthTime") Integer monthTime);

    List<MjProject> selectHomeListByTime(@Param("time") Date time);

    List<MjProject> selectGroupHomeListByTime(@Param("time") Date time, @Param("groupId") Integer groupId);

    List<MjProject> selectHomeListByYearTime(@Param("time") Date time);

    List<HomeProjectMsg> selectHomeSignProjectListByTime(@Param("time") Date time, @Param("endTime") Date endTime,
                                                         @Param("startArrivalTime") Date startArrivalTime,
                                                         @Param("endArrivalTime") Date endArrivalTime,
                                                         @Param("businessIds") String[] businessIds,
                                                         @Param("areaId") Integer areaId, @Param("invoiceCompany") String invoiceCompany,
                                                         @Param("projectName") String projectName, @Param("brands") String brands,
                                                         @Param("areaIdList") String[] areaIdList, @Param("statusList") String[] statusList,
                                                         @Param("arrivalProgressIdList") String[] arrivalProgressIdList,
                                                         @Param("invoiceCompanyIdList") String[] invoiceCompanyIdList,
                                                         @Param("orderNO") String orderNO,
                                                         @Param("cateIdList") String[] cateIdList,
                                                         @Param("innerPriceSearchArr") String[] innerPriceSearchArr,
                                                         @Param("actualValuePriceSearchArr") String[] actualValuePriceSearchArr,
                                                         @Param("saleRealPriceSearchArr") String[] saleRealPriceSearchArr,
                                                         @Param("estimatedCostSearchArr") String[] estimatedCostSearchArr,
                                                         @Param("actualCostSearchArr") String[] actualCostSearchArr,
                                                         @Param("arrivalRateSearchArr") String[] arrivalRateSearchArr,
                                                         @Param("estimatedSelfMediaCostSearchArr") String[] estimatedSelfMediaCostSearchArr,
                                                         @Param("estimatedExternalMediaCostSearchArr") String[] estimatedExternalMediaCostSearchArr,
                                                         @Param("actualSelfMediaCostSearchArr") String[] actualSelfMediaCostSearchArr,
                                                         @Param("actualExternalMediaCostSearchArr") String[] actualExternalMediaCostSearchArr);

    int selectCountByTimeAndAreaId(@Param("time") Date time, @Param("areaId") Integer areaId);

    int selectCheckGroup(@Param("time") Date time, @Param("groupId") Integer groupId);

    int selectProjectCountByTimeAndAreaId(@Param("time") Date time, @Param("areaId") Integer areaId);

    int selectProjectCountByGroupId(@Param("time") Date time, @Param("groupId") Integer groupId);

    List<MjProject> selectListByBusinessIdAndYearTime(@Param("businessId") int businessId, @Param("startTime") Date startTime,
                                                      @Param("endTime") Date endTime);

    int updateFailStatusByProjectId(@Param("projectId") int projectId, @Param("failReason") String failReason);

    int updateIsPackageById(@Param("projectId") int projectId);

    List<MediumCountProjectDTO> selectProjectListFromMediumCount();

    MjProject selectMsgByName(@Param("name") String name, @Param("projectId") Integer projectId);

    List<MjProject> selectMsgByBrandId(@Param("brandId") Integer id, @Param("businessUserId") Integer businessUserId);

    int updateFinalTimeByProjectId(@Param("projectId") int projectId, @Param("date") Date date);

    List<MjProject> selectProjectMsgByBrandId(@Param("brandId") Integer brandId);

    int updateTestBrandIdByBusinessAccountId(@Param("brandId") Integer brandId, @Param("maxBusinessAccountId") Integer maxBusinessAccountId);

    List<MjProject> selectTestListByStatus2();

    List<MjProject> selectMsgByBusinessAccountId(@Param("businessAccountId") Integer businessAccountId);

    int updateBusinessByBusinessId(@Param("businessIdList") String[] ids,
                                   @Param("businessUserId") Integer businessUserId,
                                   @Param("username") String username);

    int updateBusinessByBrandId(@Param("businessIdList") String[] ids,
                                @Param("username") String username);

    List<MjProject> selectProjectListByYearTimeAndBusinessId(@Param("time") Date time, @Param("businessId") Integer businessId);

    List<BusinessPerfomanceDTO> selectArriveProjectList(@Param("arriveTime") Date arriveTime, @Param("businessId") Integer businessId);

    List<BusinessPerfomanceDTO> selectYearProjectList(@Param("arriveTime") Date arriveTime, @Param("businessId") Integer businessId);

    List<BusinessPerfomanceDTO> selectQuarterArriveProjectList(@Param("startTime") Date startTime,
                                                               @Param("endTime") Date endTime, @Param("businessId") Integer businessId);

    int updateDelFinalTimeById(@Param("id") Integer id);

    int updateSomePriceById(@Param("projectId") Integer projectId, @Param("actualValuePrice") BigDecimal actualValuePrice);

    List<MjProject> selectListByBrandId(@Param("businessAccountId") Integer businessAccountId,
                                        @Param("businessUserId") Integer businessUserId);

    int updateDemandById(@Param("projectId") Integer id, @Param("projectDemand") String projectDemand);

    int updateNameById(@Param("projectId") Integer projectId, @Param("name") String name);

    int updateBrandPlacementPicById(@Param("projectId") Integer projectId, @Param("pic") String pic);
}